package com.alliky.home.mvp.presenter

import com.alliky.common.entity.vo.BannerEntityInfo
import com.alliky.core.base.BasePresenter
import com.alliky.core.ext.ss
import com.alliky.home.mvp.contract.HomeContract
import com.alliky.home.mvp.model.HomeModel
import java.util.*

/**
 * @Author: wxianing
 * @CreateDate: 2022/2/22 21:25
 * @Description: java类作用描述
 */
class HomePresenter : BasePresenter<HomeContract.Model, HomeContract.View>(),
    HomeContract.Presenter {

    override fun createModel(): HomeContract.Model? = HomeModel()

    override fun getBanner(type: Int) {
        mModel?.getBanner(type)?.ss(mModel, mView) {
            val infoList: MutableList<BannerEntityInfo> = ArrayList()
            for (entity in it.data) {
                val info = BannerEntityInfo()
                info.bannerEntity = entity
                infoList.add(info)
            }
            mView?.showBanner(infoList)
        }
    }

}